package com.itjavas.cslp2.controller;

import com.itjavas.cslp2.mapper.RecordMapper;
import com.itjavas.cslp2.pojo.entity.Course;
import com.itjavas.cslp2.pojo.entity.Record;
import com.itjavas.cslp2.pojo.entity.User;
import com.itjavas.cslp2.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/record")
public class RecordController {
    @Autowired
    RecordService recordService;

    //添加选课记录
    @RequestMapping("/addRecord")
    public ResponseEntity<Boolean> addRecord(@RequestBody String courseId, @RequestBody String userId){
        Record record = new Record();
        record.setCourseId(String.valueOf(courseId));
        record.setUserId(String.valueOf(userId));
        return recordService.addRecord(record);
    }

}
